package Math;

public class MathTest {
    public static void main(String[] args) {
        //abc取绝对值
        System.out.println(Math.abs(12));
        System.out.println(Math.abs(-12));
        System.out.println(Math.abs(-2.36));

        //ceil向上取整
        System.out.println(Math.ceil(2.0000000000001));  //3
        System.out.println(Math.ceil(2.685));       //3
        System.out.println(Math.ceil(2.5));         //3
        System.out.println(Math.ceil(2.6));         //3

        //floor向下取整
        System.out.println(Math.floor(2.7));  //2

        //round四舍五入
        System.out.println(Math.round(2.8)); //3
        System.out.println(Math.round(2.4)); //2

        //max取最大值
        //min取最小值
        System.out.println(Math.max(2.3,5)); //5
        System.out.println(Math.min(2.3,5)); //2.3


        //pow取次方
        System.out.println(Math.pow(2,3)); //8
        System.out.println(Math.pow(1,3)); //1

        //随机数：[0.0,1.0)
        System.out.println(Math.random());
    }
}
